// struct


#[derive(Debug)]
struct File {
    name: String,
    data: Vec<u8>,
}

#[derive(Debug)]
enum PokerSuit {
    Clubs,
    Spades,
    Diamonds,
    Hearts,
}

#[derive(Debug)]
struct PokerCard {
    suit: PokerSuit,
    val: u8, // 1~13
}

//
enum Poker{
    Club(u8),
    Spade(u8),
    Diamond(char),
    Heart(char),
}

enum Message{
    Quit, // 无任何值
    Move{x: i32, y:i32}, // 匿名结构体
    Write(String), // String
    Change(i32, i32, i32), // 元组
}

fn main() {
    let f1 = File {
        name: String::from("f1.txt"),
        data: Vec::new(),
    };

    let f1_name = &f1.name;
    let f1_len = &f1.data.len();

    // dbg!(f1); // 不能用，dbg!会发生所有权转移
    println!("{:#?}", f1);
    println!("name = {}, len = {}", f1_name, f1_len);

    // enum
    let heart = PokerSuit::Hearts;
    print_poker(heart);

    let c1 = PokerCard {
        suit: PokerSuit::Clubs,
        val:1,
    };
    let c2 = PokerCard {
        suit: PokerSuit::Spades,
        val:13,
    };
    print!("{:?}", c1);

}

fn print_poker(card: PokerSuit) {
    println!("{:?}", card);
}


